[/
 / Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 /
 / Distributed under the Boost Software License, Version 1.0. (See accompanying
 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 /]

[section:NullaryToken Nullary token requirements]

A nullary token is a [link boost_asio.overview.model.completion_tokens completion
token] for completion signature `void()`.

[heading Examples]

A free function as a nullary token:

  void nullary_handler()
  {
    ...
  }

A nullary token function object:

  struct nullary_handler
  {
    ...
    void operator()()
    {
      ...
    }
    ...
  };

A lambda as a nullary token:

  boost::asio::post(...,
      []()
      {
        ...
      });

A non-static class member function adapted to a nullary token using
`std::bind()`:

  void my_class::nullary_handler()
  {
    ...
  }
  ...
  boost::asio::post(...,
      std::bind(&my_class::nullary_handler, this));

A non-static class member function adapted to a nullary token using
`boost::bind()`:

  void my_class::nullary_handler()
  {
    ...
  }
  ...
  boost::asio::post(...,
      boost::bind(&my_class::nullary_handler, this));

Using [link boost_asio.reference.use_future use_future] as a nullary token:

  std::future<void> f = boost::asio::post(..., boost::asio::use_future);
  ...
  f.get();

Using [link boost_asio.reference.use_awaitable use_awaitable] as a nullary token:

  boost::asio::awaitable<void> my_coroutine()
  {
    ...
    co_await boost::asio::post(..., boost::asio::use_awaitable);
    ...
  }

[endsect]
